package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortListDemo3 {
    public static void main(String[] args) {
        List<String>list=new ArrayList<>();
        list.add("Tom");
        list.add("Jetty");
        list.add("Jack");
        list.add("Rose");
//        Collections.sort(list);
//        System.out.println(list);
        list.add("草坪");
        list.add("传奇是");
        list.add("仓拉屎发");
        list.add("事真多广东省");

       // Collections.sort(list,(s1,s2)->s1.length()-s2.length());
        Collections.sort(list, Comparator.comparingInt(String::length));
        System.out.println(list);


    }
}
